package printprime;

/**
 * Created by Veronica on 2017/4/13.
 */
/*正整数1-N之间所有质数*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Prime {
    public static void main(String[] args) throws NumberFormatException, IOException{
        System.out.println("请输入一个整数");
        BufferedReader strin=new BufferedReader(new InputStreamReader(System.in));
        int num=Integer.parseInt(strin.readLine());
        boolean flag;
        if(num>0){
            for(int i=2;i<=num;i++){
                flag = true;
                for(int j = 2; j <=Math.sqrt(i); j++){
                    if(i % j == 0){
                        flag = false;
                        break;
                    }
                }
                if(flag){
                    System.out.println(i);
                }
            }
        }else{
            System.out.println("请重新输入！");
        }
    }

}

